package com.xxx.service.impl;

import com.xxx.entity.Category;
import com.xxx.mapper.CategoryMapper;
import com.xxx.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class CategoryServiceImpl implements CategoryService {


    @Autowired
    private CategoryMapper categoryMapper;

    // 查询所有
    @Override
    public List<Category> list() {
        return categoryMapper.findAll();
    }


    // 添加
    @Override
    public int add(Category category) {
        return categoryMapper.addCategory(category);
    }


    //按编号查询
    @Override
    public Category findById(Integer categoryId) {
        return categoryMapper.findById(categoryId);
    }


    // 修改数据
    @Override
    public int update(Category category) {
        return categoryMapper.updateCategory(category);
    }
}
